<include file="Public:header" />
{:W('Navigation')}
<script src="__PUBLIC__/js/datepicker/WdatePicker.js"></script>
<div class="body-right">
	<div class="row-table">
		<div class="row-table-title">日志</div>
		<div class="row-table-body">
			<p class="form-title">
				全部日志<a class="pull-right btn btn-primary btn-xs" href="{:U('core/log/add')}">添加日志</a>
				<form id="search_form" action="" method="get">
					<input type="hidden" name="g" value="core"/>
					<input type="hidden" name="m" value="log"/>
					<div class="form-inline" >
						<div class="form-group">
							<label for="search_title">标题</label>
							<input type="text" class="form-control" id="search_title" name="search_title" />
						</div>&nbsp;&nbsp;
						<div class="form-group">
							<label for="search_content">内容</label>
							<input type="text" class="form-control" id="search_content" name="search_content" />
						</div>&nbsp;&nbsp;
						<div class="form-group">
							<label for="search_creator_user">作者</label>
							<input type="hidden" class="form-control" id="dialog_user_id" name="search_creator_id" />
							<input type="text" class="form-control" id="dialog_user_name" name="search_user_name" />
						</div>&nbsp;&nbsp;
						<div class="form-group">
							<input type="text" class="form-control" id="search_create_time" name="search_create_time" onclick="WdatePicker({dateFmt:'yyyy-MM-dd'})" placeholder="创建时间"/>
						</div>
						<input type="button" class="btn search_btn" value="搜索" />
					</div>
				</form>
			</p>
			<if condition="empty($log_list)">
				<div>---暂无数据---</div>
			<else />
			<form action="{:U('core/log/delete')}" method="post">
			<table class="table" style="margin-bottom:0px;">
				<tbody>
					<tr>
						<th><input type="checkbox" id="check_all" /></th>
						<th>标题</th>
						<th>作者</th>
						<th>创建时间</th>
						<th>操作</th>
					</tr>
					<volist name="log_list" id="vo">
					<tr>
						<td><input type="checkbox" class="check_list" name="id[]" value="{$vo.log_id}" /></td>
						<td><a href="{:U('core/log/view','id='.$vo['log_id'])}">{$vo.title}</a></td>
						<td>{$vo.creator_user_name}</td>
						<td>{$vo.create_time|date='Y-m-d H:i:s',###}</td>
						<td><a href="{:U('core/log/edit','id='.$vo['log_id'])}">编辑</a>&nbsp;|&nbsp;<a href="{:U('core/log/delete','id='.$vo['log_id'])}">删除</a></td>
					</tr>
					</volist>
				</tbody>
				<tfoot>
					<tr>
						<td><input class="btn btn-primary btn-xs" type="submit" value="删除" /></td>
						<td colspan="5">{$page}<div class="clear"></div></td>
					</tr>
				</tfoot>
			</table>
			</form>
			</if>
		</div>
	</div>
</div>
<div class="clear"></div>
<script type="text/javascript">
	$("#check_all").click(function(){
		$("input[class='check_list']").prop('checked',$(this).prop('checked'));
	});
	
	$("#search_title").prop('value', '{$Think.get.search_title}');
	$("#search_content").prop('value', '{$Think.get.search_content}');
	$("#dialog_user_name").prop('value', '{$Think.get.search_user_name}');
	$("#search_create_time").prop('value', '{$Think.get.search_create_time}');
	
	$('#dialog_user_name').click(function(){
		$('#alert').modal({
				show:true,
				remote:'{:U("core/user/getsubuserdialog", "self=1")}'
			});
	});
	
	/**
	 * 单击提交搜索表单
	 * 双击清空搜索项
	 **/
	$(function(){
		var TimeFn = null;
		$('.btn.search_btn').click(function () {
			clearTimeout(TimeFn);
			TimeFn = setTimeout(function(){
				$('#search_form').submit();
			},300);
		});
		
		$('.btn.search_btn').dblclick(function () {
			clearTimeout(TimeFn);
			window.location.href="{:U('core/log/index')}";
		})
	});
</script>
<include file="Public:alert" />
<include file="Public:footer" />